home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / add images.cpt / Result.c < prev    next >
Text File  |  1989-06-22  |  19KB  |  660 lines

  1. /* ===================================
  2.  
  3. File: Result.c
  4. Function: Handle all operations for this window
  5. History: 4/27/89 Original by Prototyper.
  6.  
  7. ================================= */
  8.  
  9. #include "Result.h"
  10. #include "pix_io.h"
  11. #include <ColorToolbox.h>
  12. #include <IM5protos.h>
  13.  
  14. WindowPtr Result_Window;    /* Window pointer -- global variable */
  15. Rect result_rect;                /* top/bottom/left/right coords of current result image */
  16. static short off_top, off_left;    /* offsets on the window from scrolling */
  17.  
  18. extern short pix_zoom;
  19. extern PaletteHandle mypalette;
  20. extern RGBColor BlackRGB, whiteRGB, grayRGB;
  21.  
  22. static Str255 filename;
  23.  
  24. PicHandle result_pic;
  25. CGrafPtr result_bmap;
  26.  
  27. static void draw_result( void );
  28.  
  29. static void HandleVScrollBar (short code, short Start, short Stop,
  30.                               short Increment, short LIncrement,
  31.                               ControlHandle theControl, Point myPt);
  32.  
  33. static void HandleHScrollBar (short code, short Start, short Stop,
  34.                               short Increment, short LIncrement,
  35.                               ControlHandle theControl, Point myPt);
  36.  
  37. static void Do_A_ScrollBar (short code, ControlHandle theControl, Point myPt);
  38.  
  39.  
  40.  
  41. /* *********************************** */
  42. /* These are the other includes for general routines */
  43.  
  44. #include <Strings.h>
  45. extern char *strcpy (Str255 *, char *);    /* LSC string prototype */
  46.  
  47. /* *********************************** */
  48.  
  49. #define      TRUE   1
  50. #define      FALSE  0
  51. #define      NIL    0
  52.  
  53. /* *********************************** */
  54.  
  55. /* Scrollbar ID */
  56. #define    I_Vertical_Scroll_bar     29
  57. /* Scrollbar ID */
  58. #define    I_Horiz_Scroll_bar     28
  59.  
  60. #define min_scroll 1
  61. #define max_scroll 100
  62. #define small_step 1
  63. #define large_step 10
  64.  
  65. static Rect tempRect, temp2Rect;    /* Temporary rectangle */
  66. static short Index;            /* For looping */
  67. static ControlHandle CtrlHandle;    /* Control handle */
  68. static ControlHandle ScrollHHandle, ScrollVHandle;    /* Scrolling Control*/
  69. static Str255 sTemp;        /* Get text entered, temp holding */
  70. static OSErr MyErr;            /* General OS error return */
  71. static ControlHandle C_Vertical_Scroll_bar;    /* Scroll bar  Control Handl*/
  72. static ControlHandle C_Horiz_Scroll_bar;    /* Scroll bar  Control Handl*/
  73.  
  74. /* ====================================== */
  75.  
  76. /* Initialize us so all our routines can be activated */
  77. void Init_Result ()
  78. {
  79.     Result_Window = NIL;            /* Make sure other routines know we are not */
  80.     result_rect.top = 0;
  81.     result_rect.bottom = all_my_colors;
  82.     result_rect.left = 0;
  83.     result_rect.right = 300;
  84. }
  85.  
  86. /* ================================= */
  87.  
  88. void activate_result (whichWindow, modifiers)
  89.     WindowPtr whichWindow;
  90.     long modifiers;
  91. {
  92.     WindowPtr SavePort;
  93.  
  94.     GetPort (&SavePort);
  95.     if ( modifiers & activeFlag != 0 )
  96.     {
  97.         SelectWindow(whichWindow);
  98.         SetPort(whichWindow);
  99.         ShowControl (ScrollHHandle);
  100.         ShowControl (ScrollVHandle);
  101.         DrawGrowIcon( whichWindow );
  102.         DrawControls( whichWindow );
  103.     }
  104.     else
  105.     {
  106.         SetPort(whichWindow);
  107.         HideControl (ScrollHHandle);
  108.         HideControl (ScrollVHandle);
  109.         DrawGrowIcon( whichWindow );
  110.         DrawControls( whichWindow );
  111.     }
  112.     SetPort(SavePort);
  113. }
  114.  
  115. typedef WStateData **WStateHandle;
  116.  
  117. void zoom_result( where, whichWindow, code )
  118.     Point * where;
  119.     WindowPeek whichWindow;
  120.     short code;
  121. {
  122.     Point myPt;
  123.     WStateHandle WState;
  124.  
  125.     SetPort (whichWindow);
  126.  
  127.     if ( whichWindow->dataHandle != NIL )
  128.     {
  129.         WState = (WStateHandle) whichWindow->dataHandle;
  130.         (**WState).stdState = result_rect;
  131.         (**WState).stdState.top += 40;
  132.         (**WState).stdState.left += 2;
  133.         (**WState).stdState.right += 2;
  134.         (**WState).stdState.bottom += 40;
  135.         if (  (**WState).stdState.bottom > screenBits.bounds.bottom )
  136.         {
  137.             (**WState).stdState.bottom = screenBits.bounds.bottom - 5;
  138.         }
  139.         if (  (**WState).stdState.right > screenBits.bounds.right )
  140.         {
  141.             (**WState).stdState.right = screenBits.bounds.right - 5;
  142.         }
  143.  
  144.     }
  145.     myPt = *where;    /* Get mouse position */
  146.     GlobalToLocal (&myPt);    /* Make it relative */
  147.  
  148.     if (TrackBox (whichWindow, myPt, code) == TRUE)
  149.     {
  150.         EraseRect( &whichWindow->port.portRect );
  151.         ZoomWindow (whichWindow, code, TRUE);
  152.         InvalRect (&whichWindow->port.portRect);    
  153.     }
  154.     Resized_Result( Result_Window );
  155. }
  156.  
  157. void grow_result( where, whichWindow )
  158.     Point * where;
  159.     WindowPtr whichWindow;
  160. {
  161.     Point myPt;
  162.     Rect OldRect;
  163.     long mResult;
  164.  
  165.     SetPort (whichWindow);
  166.  
  167.     myPt = *where;
  168.     GlobalToLocal (&myPt);    /* Make it relative */
  169.  
  170.     OldRect.left = whichWindow->portRect.left;
  171.     OldRect.right = whichWindow->portRect.right;
  172.     OldRect.top = whichWindow->portRect.top;
  173.     OldRect.bottom = whichWindow->portRect.bottom;
  174.  
  175.     mResult = GrowWindow (whichWindow, *where, &result_rect);
  176.  
  177.     SizeWindow (whichWindow, LoWord (mResult),
  178.                 HiWord (mResult), TRUE);
  179.     Resized_Result(Result_Window);
  180. }
  181.  
  182. /* We were resized or zoomed, update the scrolling scrollbars */
  183. void Resized_Result ( whichWindow)    /* Resized this window */
  184.     WindowPtr whichWindow;        /* Window that was resized */
  185. {
  186.     WindowPtr SavePort;        /* Place to save the last port */
  187.     Rect temp2Rect;            /* temp rectangle */
  188.  
  189.     GetPort (&SavePort);
  190.     SetPort (Result_Window);
  191.  
  192.     if (ScrollHHandle != NIL)
  193.     {
  194.         HLock ((Handle)ScrollHHandle);
  195.         HideControl (ScrollHHandle);
  196.  
  197.         InvalRect (&(*ScrollHHandle)->contrlRect);    /* Flag old position for update rout*/
  198.  
  199.         MoveControl (ScrollHHandle, Result_Window->portRect.left-1,
  200.             Result_Window->portRect.bottom - 15);
  201.         SizeControl (ScrollHHandle, (Result_Window->portRect.right 
  202.             - Result_Window->portRect.left) - 13, 16);
  203.  
  204.         ShowControl (ScrollHHandle);
  205.         HUnlock ((Handle)ScrollHHandle);
  206.     }
  207.     if (ScrollVHandle != NIL)
  208.     {
  209.         HLock ((Handle)ScrollVHandle);
  210.         HideControl (ScrollVHandle);
  211.  
  212.         InvalRect (&(*ScrollVHandle)->contrlRect);    /* Flag old position for update rout*/
  213.  
  214.         MoveControl (ScrollVHandle, Result_Window->portRect.right-15,
  215.             Result_Window->portRect.top-1);
  216.         SizeControl (ScrollVHandle, 16, (Result_Window->portRect.bottom 
  217.             - Result_Window->portRect.top) - 13);
  218.  
  219.         ShowControl (ScrollVHandle);
  220.         HUnlock ((Handle)ScrollVHandle);
  221.     }
  222.     InvalRect(&Result_Window->portRect);
  223.     DrawGrowIcon (Result_Window);    
  224.     SetPort (SavePort);
  225. }
  226. /* End of function */
  227.  
  228. /* ====================================== */
  229.  
  230. /* Update our window, someone uncovered a part of us */
  231. void UpDate_Result (whichWindow)
  232. WindowPtr whichWindow;
  233. {
  234.     WindowPtr SavePort;        /* Place to save the last port */
  235.  
  236.     GetPort (&SavePort);    /* Save the current port */
  237.     SetPort (Result_Window);    /* Set the port to my window */
  238.  
  239.     InvalRect(&Result_Window->portRect);
  240.  
  241.     BeginUpdate (Result_Window);
  242.     draw_result();
  243.     DrawControls (Result_Window);    /* Draw all the controls */
  244.     DrawGrowIcon (Result_Window);    /* Draw the Grow box */
  245.     EndUpdate ( Result_Window );
  246.     SetPort (SavePort);    /* Restore the old port */
  247. }
  248.  
  249. extern CGrafPtr proton_bmap;
  250. extern Rect proton_rect;
  251. extern short s1_off_top, s1_off_left;
  252. extern CGrafPtr flourine_bmap;
  253. extern Rect flourine_rect;
  254. extern short s2_off_top, s2_off_left;
  255.  
  256. short src_changed; /* global: 1 if either source image has moved or changed, 0 otherwise */
  257.  
  258. static void draw_result()
  259. {
  260.     Rect clipper;
  261.     short i;
  262.     Rect offrect;
  263.     GDHandle themaxdevice;
  264.     Point tempP;
  265.     Rect globRect;
  266.     
  267.     clipper.top = Result_Window->portRect.top;
  268.     clipper.bottom = Result_Window->portRect.bottom - 15;
  269.     clipper.right = Result_Window->portRect.right - 15;
  270.     clipper.left = Result_Window->portRect.left;
  271.  
  272.     ClipRect( &clipper );
  273.  
  274.     EraseRect( &clipper );
  275.     if ( proton_bmap != NIL && flourine_bmap != NIL )
  276.     {
  277.         if ( src_changed )
  278.         {
  279.             tempP.v = Result_Window->portRect.top;
  280.             tempP.h = Result_Window->portRect.left;
  281.             LocalToGlobal(&tempP);
  282.             globRect.top = tempP.v;
  283.             globRect.left = tempP.h;
  284.  
  285.             tempP.v = Result_Window->portRect.bottom;
  286.             tempP.h = Result_Window->portRect.right;
  287.             LocalToGlobal(&tempP); 
  288.             globRect.bottom = tempP.v;
  289.             globRect.right = tempP.h;
  290.  
  291.             themaxdevice = GetMaxDevice(&globRect); 
  292.             
  293.             add_bmaps( proton_bmap, &proton_rect, s1_off_top, s1_off_left,
  294.                     flourine_bmap, &flourine_rect, s2_off_top, s2_off_left,
  295.                     &result_bmap, &result_rect, themaxdevice );  /* deletes old result_bmap, returns new one */
  296.             src_changed = FALSE;
  297.             off_top = 0;
  298.             off_left = 0;
  299.             SetCtlValue (ScrollHHandle, min_scroll);
  300.             SetCtlValue (ScrollVHandle, min_scroll);    
  301.         }
  302.  
  303.         if ( result_bmap != NIL )
  304.         {
  305.             offrect = clipper;
  306.             offrect.top += off_top;
  307.             offrect.bottom += off_top;
  308.             if ( offrect.bottom > result_rect.bottom + off_top )
  309.             {
  310.                 offrect.bottom = result_rect.bottom;
  311.                 clipper.bottom = result_rect.bottom - off_top;
  312.             }
  313.             offrect.left += off_left;
  314.             offrect.right += off_left;
  315.             if ( offrect.right > result_rect.right + off_left )
  316.             {
  317.                 offrect.right = result_rect.right;
  318.                 clipper.right = result_rect.right - off_left;
  319.             }
  320.  
  321.             HLock((Handle) (result_bmap->portPixMap));
  322.             CopyBits( *(result_bmap->portPixMap), &thePort->portBits, 
  323.                     &offrect, &clipper, (short) srcCopy, 
  324.                     (RgnHandle) NIL);
  325.             HUnlock((Handle) (result_bmap->portPixMap));
  326.         }
  327.     }
  328.     else
  329.     {
  330.         SetOrigin (off_left, off_top);
  331.         for ( i = 0; i < all_my_colors; i++)
  332.         {
  333.             PmForeColor( i );
  334.             MoveTo( 0, i );
  335.             LineTo( 300, i );
  336.         }
  337.         SetOrigin (0, 0);
  338.     }
  339.     ClipRect( &Result_Window->portRect );
  340. }
  341.  
  342. /* End of UpDate */
  343.  
  344. /*  ===========================================  */
  345. /* vertical scroll bar */
  346.  
  347. static void HandleVScrollBar (code, Start, Stop, Increment, LIncrement,
  348.                               theControl, myPt)
  349.     short code;                    /*  Selection code for part of scroll bar  */
  350.     short Start;                /*  Minimum value the scroll bar can assume */
  351.     short Stop;                    /*  Maximum value the scroll bar can assume */
  352.     short LIncrement, Increment;    /*  Increment to move when pressed in an*/
  353.     ControlHandle theControl;    /*  Handle to the scroll bar control */
  354.     Point myPt;                    /*  Returned point from track the scrollbar */
  355. {                        /*  Start of this function */
  356.     short theValue;            /*  Value of the scrollbar */
  357.     long MaxTick;            /*  Timer used for repeat scrolling */
  358.  
  359.     do                        /* Do the scroll as long as the button is do*/
  360.     {                    /* Timer used for repeat scrolling */
  361.         HiliteControl (theControl, code);    /* Darken the arrow */
  362.         theValue = GetCtlValue (theControl);    /* Get current state */
  363.  
  364.         if (code == inUpButton)    /* See if in the Up arrow */
  365.         {
  366.             theValue = theValue - Increment;    /* Subtract the single d*/
  367.             if (theValue < Start)    /* Check for boundary conditions */
  368.                 theValue = Start;    /* Pin at the start value */
  369.         }
  370.  
  371.         if (code == inDownButton)    /* See if in the Down arrow */
  372.         {
  373.             theValue = theValue + Increment;    /* Add the single decrem*/
  374.             if (theValue > Stop)    /* Check for boundary conditions */
  375.                 theValue = Stop;    /* Pin at the stop value */
  376.         }
  377.  
  378.         if (code == inPageUp)    /* See if in the up/left grey area */
  379.         {
  380.             theValue = theValue - LIncrement;    /* Subtract the page inc*/
  381.             if (theValue < Start)    /* Check for boundary conditions */
  382.                 theValue = Start;    /* Pin at the Start value */
  383.         }
  384.  
  385.         if (code == inPageDown)    /* See if in the down/right grey area */
  386.         {
  387.             theValue = theValue + LIncrement;    /* Add the page incremen*/
  388.             if (theValue > Stop)    /* Check for boundary conditions */
  389.                 theValue = Stop;    /* Pin at the Stop value */
  390.         }
  391.  
  392.         if (code == inThumb)    /* See if in the drag box area */
  393.         {
  394.             code = TrackControl (theControl, myPt, NIL);    /* Let the O*/
  395.             theValue = GetCtlValue (theControl);    /* Get current state*/
  396.         }
  397.  
  398.         SetCtlValue (theControl, theValue);    /* Set new state */
  399.  
  400.         off_top = (short) ( (double)(result_rect.bottom - result_rect.top) * (double) theValue
  401.             / (double) (Stop - Start) );
  402.  
  403.         draw_result();
  404.     
  405.         MaxTick = TickCount () + 9;    /* Time delay for auto-scroll */
  406.         do    /* Start of delay routine */
  407.         { /* Spin on doing nothing */
  408.         } while ((Button () == TRUE) && (TickCount () <= MaxTick));    /* E*/
  409.  
  410.         HiliteControl (theControl, 0);    /* Lighten the arrow */
  411.     }                    /* End for StillDown */
  412.     while (StillDown () == TRUE);    /* End for StillDown */
  413. }
  414.  
  415. /* End for HandleVScrollBar */
  416.  
  417. /* ====================================================== */
  418.  
  419. /* horizontal scroll bar */
  420.  
  421. static void HandleHScrollBar (code, Start, Stop, Increment, LIncrement,
  422.                               theControl, myPt)
  423.     short code;                    /*  Selection code for part of scroll bar  */
  424.     short Start;                /*  Minimum value the scroll bar can assume */
  425.     short Stop;                    /*  Maximum value the scroll bar can assume */
  426.     short LIncrement, Increment;    /*  Increment to move when pressed in an*/
  427.     ControlHandle theControl;    /*  Handle to the scroll bar control */
  428.     Point myPt;                    /*  Returned point from track the scrollbar */
  429. {                        /*  Start of this function */
  430.     short theValue;            /*  Value of the scrollbar */
  431.     long MaxTick;            /*  Timer used for repeat scrolling */
  432.  
  433.     do                        /* Do the scroll as long as the button is do*/
  434.     {                    /* Timer used for repeat scrolling */
  435.         HiliteControl (theControl, code);    /* Darken the arrow */
  436.         theValue = GetCtlValue (theControl);    /* Get current state */
  437.  
  438.         if (code == inUpButton)    /* See if in the Up arrow */
  439.         {
  440.             theValue = theValue - Increment;    /* Subtract the single d*/
  441.             if (theValue < Start)    /* Check for boundary conditions */
  442.                 theValue = Start;    /* Pin at the start value */
  443.         }
  444.  
  445.         if (code == inDownButton)    /* See if in the Down arrow */
  446.         {
  447.             theValue = theValue + Increment;    /* Add the single decrem*/
  448.             if (theValue > Stop)    /* Check for boundary conditions */
  449.                 theValue = Stop;    /* Pin at the stop value */
  450.         }
  451.  
  452.         if (code == inPageUp)    /* See if in the up/left grey area */
  453.         {
  454.             theValue = theValue - LIncrement;    /* Subtract the page inc*/
  455.             if (theValue < Start)    /* Check for boundary conditions */
  456.                 theValue = Start;    /* Pin at the Start value */
  457.         }
  458.  
  459.         if (code == inPageDown)    /* See if in the down/right grey area */
  460.         {
  461.             theValue = theValue + LIncrement;    /* Add the page incremen*/
  462.             if (theValue > Stop)    /* Check for boundary conditions */
  463.                 theValue = Stop;    /* Pin at the Stop value */
  464.         }
  465.  
  466.         if (code == inThumb)    /* See if in the drag box area */
  467.         {
  468.             code = TrackControl (theControl, myPt, NIL);    /* Let the O*/
  469.             theValue = GetCtlValue (theControl);    /* Get current state*/
  470.         }
  471.  
  472.         SetCtlValue (theControl, theValue);    /* Set new state */
  473.  
  474.         off_left = (short) ( (double)(result_rect.bottom - result_rect.top) * (double) theValue
  475.             / (double) (Stop - Start) );
  476.  
  477.         draw_result();
  478.  
  479.         MaxTick = TickCount () + 9;    /* Time delay for auto-scroll */
  480.         do    /* Start of delay routine */
  481.         { /* Spin on doing nothing */
  482.         } while ((Button () == TRUE) && (TickCount () <= MaxTick));    /* E*/
  483.  
  484.         HiliteControl (theControl, 0);    /* Lighten the arrow */
  485.     }                    /* End for StillDown */
  486.     while (StillDown () == TRUE);    /* End for StillDown */
  487. }
  488.  
  489. /* End for HandleHScrollBar */
  490.  
  491. static void Do_A_ScrollBar (code, theControl, myPt)    /* Handle a ScrollBa*/
  492.     short code;                    /* Which place in scrollbar was pressed */
  493.     ControlHandle theControl;    /* Which place in scrollbar was pressed */
  494.     Point myPt;                    /* Where the scrollbar was pressed */
  495. {                        /* Start of a ScrollBar being pressed */
  496.     short RefCon;
  497.  
  498.     RefCon = GetCRefCon (theControl);    /* get control refcon */
  499.  
  500.     switch (RefCon)            /* Select correct scrollbar */
  501.     {                    /*Start correct scrollbar */
  502.     case I_Vertical_Scroll_bar:    /* Vertical Scroll bar, scroll bar */
  503.         HandleVScrollBar (code, min_scroll, max_scroll, small_step, large_step, theControl, myPt);    /* c*/
  504.         break;                /* End for handling a scroll bar */
  505.  
  506.     case I_Horiz_Scroll_bar:    /* Horiz Scroll bar, scroll bar */
  507.         HandleHScrollBar (code, min_scroll, max_scroll, small_step, large_step, theControl, myPt);    /* c*/
  508.         break;                /* End for handling a scroll bar */
  509.  
  510.     default:                /* allow other scrollbars (lists), trap for */
  511.         break;                /* end of default */
  512.     }                    /* end of switch */
  513. }
  514.  
  515. /* Handle a ScrollBar being pressed */
  516.  
  517. /* ================================= */
  518.  
  519. /* Open our window and draw everything */
  520. void Open_Result ()
  521. {
  522.     short Index;
  523.     Rect dataBounds;
  524.     Point cSize;
  525.  
  526.     if (Result_Window == NIL)
  527.     {
  528.         /* Result_Window = (WindowPtr) GetNewCWindow (10, NIL, (WindowPtr) - 1); -- Get the w*/
  529.  
  530.         tempRect.top = 139;
  531.         tempRect.bottom = 334;
  532.         tempRect.left = 399;
  533.         tempRect.right = 590;
  534.         Result_Window = (WindowPtr) NewCWindow( (Ptr) NIL, &tempRect, "\pResult",
  535.              (Boolean) true, 8, (WindowPtr)-1, (Boolean) false, 10L);
  536.  
  537.         /* MoveWindow (Result_Window, tempRect.left, tempRect.top, TRUE); */
  538.  
  539.         SetPort (Result_Window);
  540.  
  541.         /*  Make a scroll bar, Vert Scroll bar   */
  542.         ScrollVHandle = GetNewControl (I_Vertical_Scroll_bar, Result_Window);
  543.  
  544.         /*  Make a scroll bar, Horiz Scroll bar   */
  545.  
  546.         ScrollHHandle = GetNewControl (I_Horiz_Scroll_bar, Result_Window);
  547.  
  548.         ShowWindow (Result_Window);
  549.         SelectWindow (Result_Window);
  550.  
  551.         /* SetPalette( Result_Window, mypalette, true); */
  552.         /* RGBBackColor(&whiteRGB); */
  553.         /* RGBForeColor(&BlackRGB); -- copybits usually expect black fore and white back */
  554.         /* OpColor(&grayRGB); */
  555.  
  556.         Resized_Result (Result_Window);
  557.     }
  558.     else
  559.     {
  560.         SelectWindow (Result_Window);    /* Already open, so show it */
  561.     }
  562. }
  563.  
  564. /* End of open function */
  565.  
  566. /* ================================= */
  567.  
  568. /* Handle action to our window, like controls */
  569. void Do_Result (myEvent)
  570.     EventRecord *myEvent;
  571. {
  572.     short RefCon;            /* RefCon for controls */
  573.     short code;                /* Location of event in window or controls */
  574.     short theValue;            /* Current value of a control */
  575.     WindowPtr whichWindow;    /* Window pointer where event happened */
  576.     Point myPt;                /* Point where event happened */
  577.     ControlHandle theControl;    /* Handle for a control */
  578.     WindowPtr SavePort;
  579.  
  580.     /* Start of Window handler */
  581.     if (Result_Window != NIL)    /* Handle only when the window is valid */
  582.     {
  583.         GetPort (&SavePort);
  584.         SetPort(Result_Window);
  585.         
  586.         SetOrigin(0, 0);
  587.     
  588.         code = FindWindow (myEvent->where, &whichWindow);    /* Get where*/
  589.  
  590.         if ((myEvent->what == mouseDown) && (Result_Window == whichWindow))
  591.         {
  592.             myPt = myEvent->where;    /* Get mouse position */
  593.             GlobalToLocal (&myPt);    /* Make it relative */
  594.         }
  595.  
  596.         if ((Result_Window == whichWindow) && (code == inContent))    /* for o*/
  597.         {
  598.  
  599.             code = FindControl (myPt, whichWindow, &theControl);    /* G*/
  600.  
  601.             if ((code == inUpButton) || (code == inDownButton)
  602.                 || (code == inThumb) || (code == inPageDown)
  603.                 || (code == inPageUp))
  604.                 Do_A_ScrollBar (code, theControl, myPt);    /* Do scroll*/
  605.             if (code != 0)    /* Check type of control */
  606.                 code = TrackControl (theControl, myPt, NIL);    /* Track*/
  607.  
  608.         }                /* End for if (Result_Window==whichWindow) */
  609.     }                    /* End for if (Result_Window != NIL) */
  610.     SetPort(SavePort);
  611. }
  612.  
  613. /* End of function */
  614.  
  615. /* ================================= */
  616.  
  617. void save_result()
  618. /* saves results PICT2 to a PICT file -- called when SAVE PICT menu item chosen */
  619. {
  620. /*    check to see if there is a result-pict
  621.     if not, then beep
  622.     else
  623.         put up save files dialog
  624.         if not cancelled then
  625.             open a new PICT file
  626.             write 512-byte empty header
  627.             write the PICT from the Handle to the file
  628.         end if
  629.     end if
  630. */
  631. }
  632.  
  633. void copy_result()
  634. /* copys a PICT from the result pixmap into the clipboard */
  635. {
  636.     short err;
  637.     
  638.     if ( result_pic != NIL )
  639.     {
  640.         HLock( (Handle) result_pic );
  641.         err = PutScrap( GetHandleSize( (Handle)result_pic ), 'PICT', *result_pic);
  642.         HUnlock( (Handle) result_pic );
  643.     }
  644. }
  645.  
  646. void cut_result()
  647. /* copys a PICT from the result pixmap into the clipboard, and then clears the pixmap */
  648. {
  649.  
  650. }
  651.  
  652. void clear_result()
  653. {
  654.  
  655. }
  656.  
  657. void crop_result()
  658. {
  659.  
  660. }